package com.ldzy.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ldzy.dao.BookMapper;
import com.ldzy.pojo.Achievement;
import com.ldzy.pojo.Student;
import com.ldzy.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class BookServiceImpl implements BookService {
    @Resource
    private BookMapper bookMapper;
    @Override
    public Page<Student> selectNewBooks() {
        PageHelper.startPage(1,5);
        Page<Student> students=bookMapper.selectNewBooks();
        return students;
    }

    @Override
    public Page<Student> selectPageByIndex(int index) {
        return null;
    }


    @Override
    public void deleteById(int id) {
        bookMapper.deleteById(id);

    }

    @Override
    public Student findById(int id) {
        Student student=bookMapper.findById(id);
        return student;
    }

    @Override
    public void edit(Student student) {
        {
            bookMapper.edit(student);
        }
    }
    @Override
    public Page<Achievement> searchBorrowed() {
        PageHelper.startPage(1,5);
        Page<Achievement> achievements =bookMapper.searchBorrowed();
        return achievements;
    }
}
